}
_getBounds(pos) {
+ if (this.allowLongSwipes)
+ return [this._snapPoints[0], this._snapPoints[this._snapPoints.length - 1]];
+
const closest = this._findClosestPoint(pos);
let prev, next;
this._progress += delta / distance;
this._history.append(time, delta);
- const [lower, upper] = this.allowLongSwipes
- ? [this._snapPoints[0], this._snapPoints[this._snapPoints.length - 1]]
- : this._getBounds(this._initialProgress);
-
- this._progress = Math.clamp(this._progress, lower, upper);
+ this._progress = Math.clamp(this._progress, ...this._getBounds(this._initialProgress));
this.emit('update', this._progress);
}
}
pos = pos * Math.sign(velocity) + this._progress;
-
- if (!this.allowLongSwipes)
- pos = Math.clamp(pos, ...this._getBounds(this._initialProgress));
+ pos = Math.clamp(pos, ...this._getBounds(this._initialProgress));
const index = this._findPointForProjection(pos, velocity);